-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
imaplib: append returns a tuple (status, [data])
#15183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
According to the docstring for append: ``` (typ, [data]) = <instance>.append(mailbox, flags, date_time, message) ``` [v3.0](https://github.com/python/cpython/blob/v3.0/Lib/imaplib.py#L313) [v3.14](https://github.com/python/cpython/blob/v3.14.0/Lib/imaplib.py#L483) Further corroborated that this is a tuple of some sort because append returns the result of `self._simple_command(...)`, which returns the result of `self._command_complete(...)`, which returns `typ, data`.
This comment has been minimized.
This comment has been minimized.
donbarbos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Only one nit
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
srittau
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| def recent(self) -> _CommandResults: ... | ||
| def response(self, code: str) -> _CommandResults: ... | ||
| def append(self, mailbox: str, flags: str, date_time: str, message: ReadableBuffer) -> str: ... | ||
| def append(self, mailbox: str, flags: str, date_time: str, message: ReadableBuffer) -> tuple[str, _list[bytes]]: ... |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in #15187
According to the docstring for
append:Python v3.0
Python v3.14
Further corroborated that this is a tuple because
appendreturns the result ofself._simple_command(...), which returns the result ofself._command_complete(...), which returnstyp, data.From something like this
I'm getting a Mypy (v1.17.1) type error:
when in practice unpacking the tuple works just fine.